{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import string\n",
    "import os\n",
    "\n",
    "digits = string.digits\n",
    "operators = '+-*'\n",
    "characters = digits + operators + '() '\n",
    "print(characters)\n",
    "\n",
    "width, height, n_len, n_class = 180, 60, 7, len(characters) + 1\n",
    "print(n_class)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from captcha.image import ImageCaptcha\n",
    "generator = ImageCaptcha(width=width, height=height, font_sizes=range(35, 56), \n",
    "                         fonts=['fonts/%s'%x for x in os.listdir('fonts') if '.tt' in x])\n",
    "generator.generate_image('(1-2)-3')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from image import ImageCaptcha\n",
    "generator = ImageCaptcha(width=width, height=height, font_sizes=range(35, 56), \n",
    "                         fonts=['fonts/%s'%x for x in os.listdir('fonts') if '.tt' in x])\n",
    "generator.generate_image('(1-2)-3')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
